#include <func.h>

int main(int argc, char* argv[])
{
    printf("执行一些代码\n");
    //获取core文件
    pid_t pid = fork();
    switch(pid)
    {
    case -1:
        error(1, errno, "fork");
    case 0:
        printf("chile: pid = %d, ppid = %d\n", getpid(), getppid());
        abort();
        break;
    default:
        printf("parent: pid = %d, ppid = %d\n", getpid(), getppid());
        int status;
        pid_t child_pid = waitpid(pid, &status, WCONTINUED);
        if(child_pid == -1)
            error(1, errno, "waitpid");
        break;
    }

    printf("自行后续逻辑\n");

    return 0;
}

